package com.itheima.stock.mapper;

import com.itheima.stock.common.domain.InnerMarketDomain;
import com.itheima.stock.pojo.StockMarketIndexInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author computer
* @description 针对表【stock_market_index_info(国内大盘数据详情表)】的数据库操作Mapper
* @createDate 2022-05-10 12:13:06
* @Entity com.itheima.stock.pojo.StockMarketIndexInfo
*/
@Mapper
public interface StockMarketIndexInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockMarketIndexInfo record);

    int insertSelective(StockMarketIndexInfo record);

    StockMarketIndexInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockMarketIndexInfo record);

    int updateByPrimaryKey(StockMarketIndexInfo record);

    //根据指定时间点和大盘编码查询大盘信息 时间点精确到分
    List<InnerMarketDomain> findMarketInfoByTimeAndCodes(@Param("curTime") Date curTime,
                                                         @Param("marketCodes") List<String> marketCodes);

    //查询指定大盘下 指定日期范围内 成交量信息
    //大盘的id集合 开始时间 截止时间（不一定是收盘时间）
    List<Map> getTradeVolInfoByTime(@Param("marketCodes") List<String> marketCodes,
                                    @Param("startTime") Date startTime,
                                    @Param("endTime") Date endTime);

    //批量插入数据
    int insertBatch(@Param("infos") List<StockMarketIndexInfo> infos);

}
